package cn.ciis.ciis.regionequiment;

import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Record;

import java.util.List;

public class RegionEquimentAdminService {

    public Record findByRegionEquiment(int rid,int eid){
        return Db.findFirst("select * from ciis_region_equipment where rId=? and eId=?",rid,eid);
    }

    public List<Record> findCheckedRegionEquiment(String rid){
        return Db.find("select a.rId,a.eId,b.`name`,b.`code`  from ciis_region_equipment a,ciis_equipment b  where a.eId=b.id and a.rId=?",rid);
    }

    public boolean deleteByRegionEquiment(int rid,int eid){
        int delete = Db.delete("delete from ciis_region_equipment where rId=? and eId=?", rid, eid);
        if (delete>0) {
            return true;
        }else {
            return  false;
        }
    }
}
